using System;
using System.Collections.Generic;
using System.Data;
using OracleInternal.Common;
using OracleInternal.ServiceObjects;

namespace Oracle.ManagedDataAccess.Client
{
	public class OracleNotificationEventArgs : EventArgs
	{
		internal NotificationDetails m_notificationDetails;

		internal bool m_bInfoNotPopulated = true;

		public OracleNotificationInfo Info
		{
			get
			{
				if (m_bInfoNotPopulated)
				{
					m_notificationDetails.ParseNotificationInfo();
					m_bInfoNotPopulated = false;
				}
				return m_notificationDetails.m_info;
			}
		}

		public OracleNotificationSource Source
		{
			get
			{
				if (m_bInfoNotPopulated)
				{
					m_notificationDetails.ParseNotificationInfo();
					m_bInfoNotPopulated = false;
				}
				return m_notificationDetails.m_source;
			}
		}

		public OracleNotificationType Type
		{
			get
			{
				if (m_bInfoNotPopulated)
				{
					m_notificationDetails.ParseNotificationInfo();
					m_bInfoNotPopulated = false;
				}
				return m_notificationDetails.m_type;
			}
		}

		public string[] ResourceNames
		{
			get
			{
				if (m_bInfoNotPopulated)
				{
					m_notificationDetails.ParseNotificationInfo();
					m_bInfoNotPopulated = false;
				}
				return m_notificationDetails.m_resources;
			}
		}

		public DataTable Details
		{
			get
			{
				if (m_bInfoNotPopulated)
				{
					m_notificationDetails.ParseNotificationInfo();
					m_bInfoNotPopulated = false;
				}
				return m_notificationDetails.m_details;
			}
		}

		internal List<long> QueryIdList
		{
			get
			{
				if (m_bInfoNotPopulated)
				{
					m_notificationDetails.ParseNotificationInfo();
					m_bInfoNotPopulated = false;
				}
				return m_notificationDetails.m_queryIdList;
			}
		}

		internal OracleNotificationEventArgs Clone()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleNotificationEventArgs, OracleTraceFuncName.Clone);
			}
			try
			{
				return (OracleNotificationEventArgs)MemberwiseClone();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleNotificationEventArgs, OracleTraceFuncName.Clone, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleNotificationEventArgs, OracleTraceFuncName.Clone);
				}
			}
		}

		internal OracleNotificationEventArgs(NotificationDetails notifDetails)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleNotificationEventArgs, OracleTraceFuncName.ctor);
			}
			try
			{
				m_notificationDetails = notifDetails;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleNotificationEventArgs, OracleTraceFuncName.ctor);
				}
			}
		}
	}
}
